// 自定义一个可迭代的classroom类，可迭代里面的学生，类中有班级地址，班级名称
class ClassRoom {
  constructor(address,name,student) {
    this.address = address
    this.name = name
    this.student = student
  }
  entry(stu) {
    this.student.push(stu)
  }
  [Symbol.iterator]() {
    let index = 0
    return {
      next:() =>{
        if(index < this.student.length) {
          return {done:false,value:this.student[index++]}
        }else{
          return {done:true,value:undefined}
        }
      }
    }
  }
}
const classroom = new ClassRoom('井冈山大学里面','计算机科学与技术',["jinge","json","js","html"])
classroom.entry("java")
for(const item of classroom) {
  console.log(item);
}

